package com.gogowan.agroenterprise.widget.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gogowan.agroenterprise.R;
import com.gogowan.agroenterprise.model.BianMaDiatalBean;
import com.gogowan.agroenterprise.model.ChanPinDiatalBean;
import com.gogowan.agroenterprise.utils.INewAdapterClick;

import java.util.List;

public class BianMaDiatalAdapter extends BaseAdapter {

	private final INewAdapterClick click;
	private Context context;
	private List<BianMaDiatalBean> datas;

	public BianMaDiatalAdapter(Context context, List<BianMaDiatalBean> datas, INewAdapterClick click) {
		this.context = context;
		this.datas = datas;
		this.click=click;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return datas.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return datas.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder;
		if (convertView == null) {
			convertView = LayoutInflater.from(context).inflate(R.layout.bianma_detail_item, null);
			viewHolder = new ViewHolder();
			viewHolder.tv_1 =  convertView.findViewById(R.id.tv_1);
			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		BianMaDiatalBean bianMaDiatalBean = datas.get(position);
		viewHolder.tv_1.setText(bianMaDiatalBean.getCode());
		return convertView;
	}

	static class ViewHolder {
		public TextView tv_1;
	}

}
